import { log } from "@/utils/asiainfo";

/**
 * 监听事件
 */
export const bindEvent = (socket: any) => {
  /**
   * socket 连接成功
   */
  socket.on("connect", () => {
    // 可进行登录操作
  });

  /**
   * socket 断开连接
   */
  socket.on("disconnect", () => {});

  /**
   * socket pong
   */
  socket.on("pong", (res: any) => {
    log(res);
    console.warn("[] pong", res);
  });

  /**
   * socket 消息
   */
  socket.on("message", () => {});

  /**
   * socket 连接错误
   */
  socket.on("connect_error", (err: any) => {
    log(err);
    console.warn("[] connect_error", err);
  });
};
